﻿using Kw.Combinatorics;
using System;

namespace Kw.CombinatoricsExamples
{
    class MulticombinationExample01
    {
        static void Main ()
        {
            int n = 5;
            int k = 3;

            Multicombination mc = new Multicombination (n, k);

            foreach (Multicombination row in mc.GetRows())
            {
                Console.WriteLine ("Rank {0,2}: {1}", row.Rank, row);
            }
        }

        /* Output:

        Rank  0: { 0, 0, 0 }
        Rank  1: { 0, 0, 1 }
        Rank  2: { 0, 0, 2 }
        Rank  3: { 0, 0, 3 }
        Rank  4: { 0, 0, 4 }
        Rank  5: { 0, 1, 1 }
        Rank  6: { 0, 1, 2 }
        Rank  7: { 0, 1, 3 }
        Rank  8: { 0, 1, 4 }
        Rank  9: { 0, 2, 2 }
        Rank 10: { 0, 2, 3 }
        Rank 11: { 0, 2, 4 }
        Rank 12: { 0, 3, 3 }
        Rank 13: { 0, 3, 4 }
        Rank 14: { 0, 4, 4 }
        Rank 15: { 1, 1, 1 }
        Rank 16: { 1, 1, 2 }
        Rank 17: { 1, 1, 3 }
        Rank 18: { 1, 1, 4 }
        Rank 19: { 1, 2, 2 }
        Rank 20: { 1, 2, 3 }
        Rank 21: { 1, 2, 4 }
        Rank 22: { 1, 3, 3 }
        Rank 23: { 1, 3, 4 }
        Rank 24: { 1, 4, 4 }
        Rank 25: { 2, 2, 2 }
        Rank 26: { 2, 2, 3 }
        Rank 27: { 2, 2, 4 }
        Rank 28: { 2, 3, 3 }
        Rank 29: { 2, 3, 4 }
        Rank 30: { 2, 4, 4 }
        Rank 31: { 3, 3, 3 }
        Rank 32: { 3, 3, 4 }
        Rank 33: { 3, 4, 4 }
        Rank 34: { 4, 4, 4 }

        */
    }
}
